package com.uzai.console.service.feign.impl;

import com.uzai.common.result.ResponseCode;
import com.uzai.console.common.UzaiRespVo;
import com.uzai.console.dto.feign.report.*;
import com.uzai.console.service.feign.UzaiReportServerFeignService;
import com.uzai.console.vo.feign.report.*;
import com.uzai.console.vo.main.main.ProfitVo;
import com.uzai.console.vo.report.v2.*;
import feign.hystrix.FallbackFactory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.RequestBody;

import java.util.List;

/**
 * @Auther: liuqi
 * @Date: 2021/11/24 16:24
 * @Description:
 */
@Component
public class UzaiReportFeignFallbackFactory implements FallbackFactory<UzaiReportServerFeignService> {

    private static Logger logger = LoggerFactory.getLogger(UzaiReportFeignFallbackFactory.class);

    @Override
    public UzaiReportServerFeignService create(Throwable throwable) {

        logger.error("--报表统计调用微服务失败，err:={}", throwable.getMessage());

        return new UzaiReportServerFeignService() {
            @Override
            public UzaiRespVo<List<RobotDataReportFeignVo>> robotDataReport(@RequestBody RobotDataReportFeignDto robotDataReportFeignDto) {
                UzaiRespVo<List<RobotDataReportFeignVo>> uzaiRespVo = new UzaiRespVo<>();
                uzaiRespVo.setData(null);
                uzaiRespVo.setCode(ResponseCode.ERROR);
                uzaiRespVo.setTime(System.currentTimeMillis());
                uzaiRespVo.setMsg("调用失败");
                return uzaiRespVo;
            }

            @Override
            public UzaiRespVo<List<FansValueReportFeignVo>> fansSearch(@RequestBody FansValueReportFeignDto fansValueReportFeignDto) {
                UzaiRespVo<List<FansValueReportFeignVo>> uzaiRespVo = new UzaiRespVo<>();
                uzaiRespVo.setData(null);
                uzaiRespVo.setCode(ResponseCode.ERROR);
                uzaiRespVo.setTime(System.currentTimeMillis());
                uzaiRespVo.setMsg("调用失败");
                return uzaiRespVo;
            }

            @Override
            public UzaiRespVo<FansValueReportFeignVo> fansIndicatorSerach(@RequestBody FansValueReportFeignDto fansValueReportFeignDto) {
                UzaiRespVo<FansValueReportFeignVo> uzaiRespVo = new UzaiRespVo<>();
                uzaiRespVo.setData(null);
                uzaiRespVo.setCode(ResponseCode.ERROR);
                uzaiRespVo.setTime(System.currentTimeMillis());
                uzaiRespVo.setMsg("调用失败");
                return uzaiRespVo;
            }

            @Override
            public UzaiRespVo<List<OrderRevenueReportFeignVo>> orderRevenueSearch(@RequestBody OrderRevenueReportFeignDto orderRevenueReportFeignDto) {
                UzaiRespVo<List<OrderRevenueReportFeignVo>> uzaiRespVo = new UzaiRespVo<>();
                uzaiRespVo.setData(null);
                uzaiRespVo.setCode(ResponseCode.ERROR);
                uzaiRespVo.setTime(System.currentTimeMillis());
                uzaiRespVo.setMsg("调用失败");
                return uzaiRespVo;
            }

            @Override
            public UzaiRespVo<OrderRevenueIndicatorReportFeignVo> orderRevenueIndicatorSerach(@RequestBody OrderRevenueReportFeignDto orderRevenueReportFeignDto) {
                UzaiRespVo<OrderRevenueIndicatorReportFeignVo> uzaiRespVo = new UzaiRespVo<>();
                uzaiRespVo.setData(null);
                uzaiRespVo.setCode(ResponseCode.ERROR);
                uzaiRespVo.setTime(System.currentTimeMillis());
                uzaiRespVo.setMsg("调用失败");
                return uzaiRespVo;
            }

            @Override
            public UzaiRespVo<List<ExpenseCountReportFeignVo>> expenseCountSearch(@RequestBody ExpenseCountReportFeignDto expenseCountReportFeignDto) {
                UzaiRespVo<List<ExpenseCountReportFeignVo>> uzaiRespVo = new UzaiRespVo<>();
                uzaiRespVo.setData(null);
                uzaiRespVo.setCode(ResponseCode.ERROR);
                uzaiRespVo.setTime(System.currentTimeMillis());
                uzaiRespVo.setMsg("调用失败");
                return uzaiRespVo;
            }

            @Override
            public UzaiRespVo<ExpenseCountIndicatorReportFeignVo> expenseCountIndicatorSerach(@RequestBody ExpenseCountReportFeignDto expenseCountReportFeignDto) {
                UzaiRespVo<ExpenseCountIndicatorReportFeignVo> uzaiRespVo = new UzaiRespVo<>();
                uzaiRespVo.setData(null);
                uzaiRespVo.setCode(ResponseCode.ERROR);
                uzaiRespVo.setTime(System.currentTimeMillis());
                uzaiRespVo.setMsg("调用失败");
                return uzaiRespVo;
            }

            @Override
            public UzaiRespVo<RealTimeOverviewReportFeignVo> realTimeOverviewSerach(@RequestBody RealTimeOverviewReportFeignDto realTimeOverviewReportFeignDto){
                UzaiRespVo<RealTimeOverviewReportFeignVo> uzaiRespVo = new UzaiRespVo<>();
                uzaiRespVo.setData(null);
                uzaiRespVo.setCode(ResponseCode.ERROR);
                uzaiRespVo.setTime(System.currentTimeMillis());
                uzaiRespVo.setMsg("调用失败");
                return uzaiRespVo;
            }

            @Override
            public UzaiRespVo<ProfitVo> dashboard(RealTimeOverviewReportFeignDto realTimeOverviewReportFeignDto) {
                UzaiRespVo<ProfitVo> uzaiRespVo = new UzaiRespVo<>();
                uzaiRespVo.setData(null);
                uzaiRespVo.setCode(ResponseCode.ERROR);
                uzaiRespVo.setTime(System.currentTimeMillis());
                uzaiRespVo.setMsg("调用失败");
                return uzaiRespVo;
            }

            @Override
            public UzaiRespVo<RealTimeOverviewReportFeignVo> realTimeOverviewSerach_commission(@RequestBody RealTimeOverviewReportFeignDto realTimeOverviewReportFeignDto){
                UzaiRespVo<RealTimeOverviewReportFeignVo> uzaiRespVo = new UzaiRespVo<>();
                uzaiRespVo.setData(null);
                uzaiRespVo.setCode(ResponseCode.ERROR);
                uzaiRespVo.setTime(System.currentTimeMillis());
                uzaiRespVo.setMsg("调用失败");
                return uzaiRespVo;
            }

            @Override
            public UzaiRespVo<RealTimeOverviewReportFeignVo> realTimeOverviewSerach_addFans(@RequestBody RealTimeOverviewReportFeignDto realTimeOverviewReportFeignDto){
                UzaiRespVo<RealTimeOverviewReportFeignVo> uzaiRespVo = new UzaiRespVo<>();
                uzaiRespVo.setData(null);
                uzaiRespVo.setCode(ResponseCode.ERROR);
                uzaiRespVo.setTime(System.currentTimeMillis());
                uzaiRespVo.setMsg("调用失败");
                return uzaiRespVo;
            }

            @Override
            public UzaiRespVo<RealTimeOverviewReportFeignVo> realTimeOverviewSerach_expend(@RequestBody RealTimeOverviewReportFeignDto realTimeOverviewReportFeignDto){
                UzaiRespVo<RealTimeOverviewReportFeignVo> uzaiRespVo = new UzaiRespVo<>();
                uzaiRespVo.setData(null);
                uzaiRespVo.setCode(ResponseCode.ERROR);
                uzaiRespVo.setTime(System.currentTimeMillis());
                uzaiRespVo.setMsg("调用失败");
                return uzaiRespVo;
            }

            @Override
            public UzaiRespVo<RealTimeOverviewReportFeignVo> realTimeOverviewSerach_takeBal(RealTimeOverviewReportFeignDto realTimeOverviewReportFeignDto) {
                UzaiRespVo<RealTimeOverviewReportFeignVo> uzaiRespVo = new UzaiRespVo<>();
                uzaiRespVo.setData(null);
                uzaiRespVo.setCode(ResponseCode.ERROR);
                uzaiRespVo.setTime(System.currentTimeMillis());
                uzaiRespVo.setMsg("调用失败");
                return uzaiRespVo;
            }

            //-----新版实时总览报表

            @Override
            public UzaiRespVo<RealTimeOverviewV2OrderVo> realTimeOverviewSerachV2_orderInfo(@RequestBody RealTimeOverviewReportFeignDto realTimeOverviewReportFeignDto){
                UzaiRespVo<RealTimeOverviewV2OrderVo> uzaiRespVo = new UzaiRespVo<>();
                uzaiRespVo.setData(null);
                uzaiRespVo.setCode(ResponseCode.ERROR);
                uzaiRespVo.setTime(System.currentTimeMillis());
                uzaiRespVo.setMsg("调用失败");
                return uzaiRespVo;
            }

            @Override
            public UzaiRespVo<RealTimeOverviewV2UserVo> realTimeOverviewSerachV2_userInfo(@RequestBody RealTimeOverviewReportFeignDto realTimeOverviewReportFeignDto){
                UzaiRespVo<RealTimeOverviewV2UserVo> uzaiRespVo = new UzaiRespVo<>();
                uzaiRespVo.setData(null);
                uzaiRespVo.setCode(ResponseCode.ERROR);
                uzaiRespVo.setTime(System.currentTimeMillis());
                uzaiRespVo.setMsg("调用失败");
                return uzaiRespVo;
            }

            @Override
            public UzaiRespVo<RealTimeOverviewV2UserTakeVo> realTimeOverviewV2Serach_takeInfo(@RequestBody RealTimeOverviewReportFeignDto realTimeOverviewReportFeignDto){
                UzaiRespVo<RealTimeOverviewV2UserTakeVo> uzaiRespVo = new UzaiRespVo<>();
                uzaiRespVo.setData(null);
                uzaiRespVo.setCode(ResponseCode.ERROR);
                uzaiRespVo.setTime(System.currentTimeMillis());
                uzaiRespVo.setMsg("调用失败");
                return uzaiRespVo;
            }

            @Override
            public UzaiRespVo<RealTimeOverviewV2MarketingVo> realTimeOverviewSerach_marketingInfo(@RequestBody RealTimeOverviewReportFeignDto realTimeOverviewReportFeignDto){
                UzaiRespVo<RealTimeOverviewV2MarketingVo> uzaiRespVo = new UzaiRespVo<>();
                uzaiRespVo.setData(null);
                uzaiRespVo.setCode(ResponseCode.ERROR);
                uzaiRespVo.setTime(System.currentTimeMillis());
                uzaiRespVo.setMsg("调用失败");
                return uzaiRespVo;
            }

            @Override
            public UzaiRespVo<RealTimeOverviewV2ExpendVo> realTimeOverviewSerach_expendInfo(RealTimeOverviewReportFeignDto realTimeOverviewReportFeignDto) {
                UzaiRespVo<RealTimeOverviewV2ExpendVo> uzaiRespVo = new UzaiRespVo<>();
                uzaiRespVo.setData(null);
                uzaiRespVo.setCode(ResponseCode.ERROR);
                uzaiRespVo.setTime(System.currentTimeMillis());
                uzaiRespVo.setMsg("调用失败");
                return uzaiRespVo;
            }

        };
    }

}
